package com.wm.wmim.server.config;

import com.github.pagehelper.PageInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * @author weiming
 * @date 2025/3/19 23:15
 * @description
 */
@Configuration
public class MyBatisConfig {

    @Bean
    public PageInterceptor pageInterceptor() {
        PageInterceptor pageInterceptor = new PageInterceptor();
        Properties properties = new Properties();
        properties.setProperty("helperDialect", "mysql");       // 数据库类型
        properties.setProperty("reasonable", "true");           // 合理化分页
        properties.setProperty("supportMethodsArguments", "true");
        properties.setProperty("autoRuntimeDialect", "true");   // 自动识别方言
        pageInterceptor.setProperties(properties);
        return pageInterceptor;
    }
}